import json

if __name__ == '__main__':
    json_data = None
    with open("/root/Source/python/tw-src/data/otel_demo/checkout_100_user50.json", 'r') as f:
        json_data = json.load(f)
    for trace_data in json_data["data"]:
        trace_id = trace_data["traceID"]
        try:
            temp = f"/root/Source/python/tw-src/data/otel_demo/checkout_user50/{trace_id}.json"
            with open(temp, 'w') as out:
                json.dump({"data": [trace_data]}, out)
        except Exception as e:
            print(e)
